package org.bhavani.quicksort;

public class quick {

	int givenAr[];
	int first,last;
	
	public int[] part(int givenAr[],int first,int last){
		
		int pivot = givenAr.length / 2 ;
		first = 0 ;
		last = givenAr.length-1 ;
		while (first < last){
			
			if (givenAr[first] < givenAr[pivot]){
				int temp = givenAr[pivot];
				givenAr[pivot] = givenAr[first];
				givenAr[first] = temp;
				
				
				first++;
			}
			if(givenAr[last] < givenAr[pivot]){
				
				int temp = givenAr[pivot];
				givenAr[pivot] = givenAr[last];
				givenAr[last]= temp;
				System.out.println("this is working");
				last--;
			}

		
		}
		
		return givenAr;
		
		
	}
	public void print( int givenAr[] ){
		for (int i = 0; i < givenAr.length; i++) {
			System.out.println(givenAr[i]);
		}
		
	}
	

	public static void main(String[] args) {
		int givenAr[] ={23,133,64,35,67};
		 quick pqrti =new quick();
		 pqrti.part(givenAr, 0, 4);
		 pqrti.print(givenAr);


	}

}
